package controller;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import model.DTO.DishDelDOT;
import service.Impl.DishServiceImpl;
import util.GetJsonUtil;
import util.ResultUtil;

import java.io.IOException;

@WebServlet("/admin/dish/delete")
public class DishDelController extends HttpServlet {
    //批量删除菜品
    @Override
    protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        DishDelDOT d= (DishDelDOT) GetJsonUtil.get(req,new DishDelDOT());
        DishServiceImpl ds=new DishServiceImpl();
        ds.del(d.getIds());
        String json= ResultUtil.getJSON(null);
        resp.getWriter().println(json);
    }
}
